#include "stdafx.h"
#include "URonddraaiendeTriangle.h"
#include "ULeafWindow.h"

TRonddraaiendeTriangle::TRonddraaiendeTriangle()
: TCustomWindow(false)
{
	rotation=0;
	speed=rand()&0xf;
}

void TRonddraaiendeTriangle::Draw( )
{
	int width  = Parent->Right-Parent->Left;
	int height = Parent->Bottom-Parent->Top;


	glTranslatef((width) - (width)/2, (height) - (height)/2, 0);
	glRotatef(rotation, 0.0f, 0.0f, 1.0f);
	rotation+=speed;

	glBegin(GL_TRIANGLES);
		glColor3f(1.0f, 0.0f, 0.0f);
		glVertex2i(0, -(height)/2);
		glColor3f(0.0f, 1.0f, 0.0f);
		glVertex2i(-(width)/2, (height)/2);
		glColor3f(0.0f, 0.0f, 1.0f);
		glVertex2i((width)/2, (height)/2);
	glEnd();


}

void TRonddraaiendeTriangle::MouseMove(int X, int Y, int mstate)
{
}

void TRonddraaiendeTriangle::MouseDown(int X, int Y, uint8 button)
{
}

void TRonddraaiendeTriangle::MouseUp(int X, int Y, uint8 button)
{
}
